<?php

class UsuarioController extends Zend_Controller_Action {   
	
	public function indexAction()    {
		
	}
	
	public function cadastroformularioAction() {
		global $db, $base_url ;
		
		require_once('classes/class.time.php') ;
		
		$this->view->base_url = $base_url ;
		//
		$time = new Time($db) ;
		$this->view->times = $time->select_from('*', 'ORDER BY nome') ;
	}
	
	public function efetuarcadastroAction() {
		global $db, $_POST ;

		require_once('classes/class.participante.php') ;
		
		if ($_POST['escolhe_time'] == 'selecionar') {
			$time_sel = $_POST['time'] ;
		} else {
			require_once('classes/class.time.php') ;
			$time = new Time($db) ;
			$time->insert($_POST['novo_time'], $_POST['inst_novo_time']);
			$time_sel = $_POST['novo_time'] ;
		}
		
		
		$participante = new Participante($db) ;
		$participante->insert($_POST['login'], $time_sel, $_POST['nome'], $_POST['email'],
							  $_POST['senha'], $_POST['pais'], $_POST['estado'], $_POST['cidade']);
	}
	
	
}


?>